package com.itheima.tlias.mapper;

import com.itheima.tlias.pojo.dto.EmpGenderDataDTO;
import com.itheima.tlias.pojo.dto.EmpJobDataDTO;
import com.itheima.tlias.pojo.dto.SelectEmpDTO;
import com.itheima.tlias.pojo.dto.SelectempDetailDTO;

import com.itheima.tlias.pojo.entity.Emp;
import com.itheima.tlias.pojo.po.InsertEmpParam;
import com.itheima.tlias.pojo.po.SelectEmpPageParam;
import com.itheima.tlias.pojo.po.UpdateEmpParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 都是标识Dao层的注解
 * @Mapper ->mybatis 提供
 * @Repository ->spring 提供
 */
//@Repository
@Mapper
public interface EmpMapper {
    List<SelectEmpDTO> selectEmpByPageParam(SelectEmpPageParam param);

    int insertEmp(InsertEmpParam param);

    int batchDeleteEmpByIds(List<Integer> ids);
    SelectempDetailDTO selectEmpById(Integer id);

    int updateEmp(UpdateEmpParam param);


    @Select("select gender ,count(gender) as 'count' from emp group by gender")
    List<EmpGenderDataDTO> empGenderData();
    @Select("select job, count(job) as count from emp group by job")
    List<EmpJobDataDTO> empJobData();
    @Select("select id,name,username ,password from emp where username=#{username}")
    Emp selectEmpByUsername(String username);
    @Select("select * from emp where username = #{username}")
    Emp selectEmpByName(String username);
}
